# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=webspa
pkgver=0.8
pkgrel=4
pkgdesc='A web knocking tool, sending a single HTTP/S to run O/S commands.'
groups=('blackarch' 'blackarch-backdoor' 'blackarch-webapp')
arch=('any')
url='http://sourceforge.net/projects/webspa/'
license=('GPL3')
depends=('java-environment' 'bash')
source=("http://downloads.sourceforge.net/project/$pkgname/$pkgname-${pkgver/./}.zip")
sha512sums=('8dd008eb04017c9faf3b282a5bf4ddb1c925ccfa945f471ef75c3933558981d1f6e6a648e032268f45a47d3744b7a461356cb9b2e384da608afada13654c1d53')

package() {
  cd "$pkgname-${pkgver/./}"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 "$pkgname-${pkgver/./}.jar" "$pkgdir/usr/share/$pkgname/"
  install -Dm 755 "$pkgname.sh" "$pkgdir/usr/share/$pkgname/$pkgname.sh"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" docs/* README INSTALL
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec java -jar /usr/share/$pkgname/$pkgname-${pkgver/./}.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

